@extends('admin.layout.index')
@section('js')
<script src="/web/js/libs/jquery-1.8.3.min.js"></script>
<script>
$(function (){
    $('[name=tid]').blur(function (){
        val = $(this).val();
        $.get('/admin/goods/verify','tid='+val, function (msg){
            if(msg == 1){
                $('#text').empty().append('<font style="color:red">请选择详细的所属分类</font>')
            }else{
                $('#text').empty().append('<font style="color:green">已选择精准的所属分类</font>')
            }
        },'html')
    })
})
</script>
@endsection
@section('content')
@if (count($errors) > 0)
    <div class="mws-form-message error">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif
<div class="mws-panel grid_8">
    <div class="mws-panel-header">
        <span>商品修改</span>
    </div>
    <div class="mws-panel-body no-padding">
        <form action="/admin/goods/update" class="mws-form" method='post' enctype="multipart/form-data">
            <input type="hidden" name='id' value='{{$data1["id"]}}'>
            {{csrf_field()}}
            <div class="mws-form-inline">
                <div class="mws-form-row">
                    <label class="mws-form-label">货号</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="articlenum" style="width:200px" value="{{$data1['articlenum']}}"><span>   【货号为6位】</span>
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">商品描述</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="goodsdes" style="width:200px" value="{{$data1['goodsdes']}}">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">商品所属类</label>
                    <div class="mws-form-item">
                        <select class="large" name="tid" style="width:200px">
                        <option>--请选择--</option>
                        @foreach($data as $k => $v)
                            <option value="{{$v['id']}}" @if($v['id'] == $data1['tid']) selected @endif>{{$v['cname']}}</option>
                        @endforeach
                        </select>
                        <span id='text'></span>
                    </div>
                </div>
                <div class="mws-form-row">
<<<<<<< HEAD
                    <label class="mws-form-label">商品适合性别</label>
                    <div class="mws-form-item">
                        <select class="large" name="gsex" style="width:200px">
                        <option value="">--请选择--</option>
                        @foreach($data3 as $v)
                            <option value="{{$v['id']}}" @if($data1['gsex'] == $v['id']) selected  @endif>{{$v['suitsex']}}</option>
                        @endforeach
                        </select>
                        <span id='text'></span>
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">商品价格范围</label>
                    <div class="mws-form-item">
                        <select class="large" name="pricerange" style="width:200px">
                            <option value=''>--请选择--</option>
                            @foreach($data2 as $v)
                                <option value="{{$v['id']}}" @if($data1['pricerange'] == $v['id']) selected @endif>{{$v['pricerange']}}</option>                             
                            @endforeach
=======
                    <label class="mws-form-label">商品价格范围</label>
                    <div class="mws-form-item">
                        <select class="large" name="pricerange" style="width:200px">
                            <option value='0' @if($data1['pricerange'] == '0') selected @endif>--请选择--</option>
                            <option value='0-200' @if($data1['pricerange'] == '0-200') selected @endif>--0-200--</option>
                            <option value='200-500' @if($data1['pricerange'] == '200-500') selected @endif>--200-500--</option>
                            <option value='500-1000' @if($data1['pricerange'] == '500-1000') selected @endif>--500-1000--</option>
                            <option value='1000-1500' @if($data1['pricerange'] == '1000-1500') selected @endif>--1000-1500--</option>
                            <option value='1500-2000' @if($data1['pricerange'] == '1500-2000') selected @endif>--1500-2000--</option>
                            <option value='2000以上' @if($data1['pricerange'] == '2000以上') selected @endif>--2000以上--</option>
>>>>>>> 31e42f2d3415b82d4888522298db4e7de5f9c8aa
                        </select>
                        <span>【必填项】</span>
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">商品价格</label>
                    <div class="mws-form-item">
                        <input type="text" name="goodsprice" value="{{$data1['goodsprice']}}">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">材质成分</label>
                    <div class="mws-form-item">
                        <select class="large" name="material" style="width:200px">
                            <option value='0'>--请选择--</option>
                            <option value='棉'  @if($data1['material'] == '棉') selected @endif>--棉--</option>
                            <option value='麻'  @if($data1['material'] == '麻') selected @endif>--麻--</option>
                            <option value='丝绸' @if($data1['material'] == '丝绸') selected @endif>--丝绸--</option>
                            <option value='呢绒' @if($data1['material'] == '呢绒') selected @endif>--呢绒--</option>
                            <option value='皮革' @if($data1['material'] == '皮革') selected @endif>--皮革--</option>
                            <option value='化纤' @if($data1['material'] == '化纤') selected @endif>--化纤--</option>
                            <option value='混纺' @if($data1['material'] == '混纺') selected @endif>--混纺--</option>
                        </select>
                        <span>【必填项】</span>
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">品牌</label>
                    <div class="mws-form-item">
                        <select class="large" name="brand" style="width:200px">
<<<<<<< HEAD
                            <option value=''>--请选择--</option>
                            @foreach($data0 as $v)
                                <option value="{{$v['id']}}" @if($data1['brand'] == $v['id']) selected @endif>{{$v['brandname']}}</option>                             
                            @endforeach
=======
                            <option value='0'>--请选择--</option>
                            <option value='布根香' @if($data1['brand'] == '布根香') selected @endif>--布根香--</option>
                            <option value='BGV' @if($data1['brand'] == 'BGV') selected @endif>--BGV--</option>
                            <option value='简约风情' @if($data1['brand'] == '简约风情') selected @endif>--简约风情--</option>
                            <option value='优衣库' @if($data1['brand'] == '优衣库') selected @endif>--优衣库--</option>
                            <option value='谜底' @if($data1['brand'] == '谜底') selected @endif>--谜底--</option>
                            <option value='betu' @if($data1['brand'] == 'betu') selected @endif>--betu--</option>
                            <option value='纯粹' @if($data1['brand'] == '纯粹') selected @endif>--纯粹--</option>
                            <option value='千百惠' @if($data1['brand'] == '千百惠') selected @endif>--千百惠--</option>
                            <option value='速购' @if($data1['brand'] == '速购') selected @endif>--速购--</option>
                            <option value='佰佧丽' @if($data1['brand'] == '佰佧丽') selected @endif>--佰佧丽--</option>
                            <option value='依路佑妮' @if($data1['brand'] == '依路佑妮') selected @endif>--依路佑妮--</option>
                            <option value='丹比奴' @if($data1['brand'] == '丹比奴') selected @endif>--丹比奴--</option>
                            <option value='丝雨桐' @if($data1['brand'] == '丝雨桐') selected @endif>--丝雨桐--</option>
                            <option value='觅玛' @if($data1['brand'] == '觅玛') selected @endif>--觅玛--</option>
                            <option value='其他' @if($data1['brand'] == '其他') selected @endif>--其他--</option>
>>>>>>> 31e42f2d3415b82d4888522298db4e7de5f9c8aa
                        </select>
                        <span>【必填项】</span>
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">风格</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="style" style="width:200px" value="{{$data1['style']}}">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">适用季节</label>
                    <div class="mws-form-item">
                        <select class="large" name="season" style="width:200px">
                            <option value='0'>--请选择--</option>
                            <option value='1' @if($data1['season'] == 1) selected @endif>--春季--</option>
                            <option value='2' @if($data1['season'] == 2) selected @endif>--夏季--</option>
                            <option value='3' @if($data1['season'] == 3) selected @endif>--秋季--</option>
                            <option value='4' @if($data1['season'] == 4) selected @endif>--冬季--</option>
                        </select>
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">适用场景</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="application" style="width:200px" value="{{$data1['application']}}">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">商品状态</label>
                    <div class="mws-form-item">
                        <select class="large" name="status" style="width:200px">
                            <option value='1' @if($data1['status'] == 1) selected @endif>--在架--</option>
                            <option value='2' @if($data1['status'] == 2) selected @endif>--促销--</option>
                            <option value='3' @if($data1['status'] == 3) selected @endif>--下架--</option>
                        </select>
                    </div>
                </div>
                <div class="mws-form-row">
<<<<<<< HEAD
=======
                    <label class="mws-form-label">促销价格</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="application" style="width:200px" value="{{$data1['goodsprice2']}}">
                    </div>
                </div>
                <div class="mws-form-row">
>>>>>>> 31e42f2d3415b82d4888522298db4e7de5f9c8aa
                    <label class="mws-form-label">商品详情</label>
                    <div class="mws-form-item">
                        <!-- 加载编辑器的容器 -->
                        <script id="containers" name="content" type="text/plain">
                            {!!$data1['content']!!}
                        </script>
                        <!-- 配置文件 -->
                        <script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
                        <!-- 编辑器源码文件 -->
                        <script type="text/javascript" src="/ueditor/ueditor.all.js">
                        </script>
                        <!-- 实例化编辑器 -->
                        <script type="text/javascript">
                            var ue = UE.getEditor('containers');
                        </script>
                    </div>
                </div>
            </div>
            <div class="mws-button-row">
                <input type="submit" class="btn btn-danger" value="修改">
                <input type="reset" class="btn " value="重置">
            </div>
        </form>
    </div>      
</div>
@endsection
